package org.soderiakelvy.model.services.testCase;

import static org.junit.Assert.*;

import java.util.List;

import junit.framework.Assert;

import org.junit.BeforeClass;
import org.junit.Test;
import org.soderiakelvy.model.dao.SucursalProductoDao;
import org.soderiakelvy.model.domain.SucursalPackVO;
import org.soderiakelvy.model.domain.SucursalProductoVO;
import org.soderiakelvy.model.domain.SujetoVO;
import org.soderiakelvy.model.domain.TipoProductoVO;
import org.soderiakelvy.model.service.ProductoServicio;
import org.soderiakelvy.model.service.SucursalServicio;
import org.soderiakelvy.model.service.SujetoServicio;
import org.soderiakelvy.model.service.imp.ProductoServicioImp;
import org.soderiakelvy.model.service.imp.SucursalServicioImp;
import org.soderiakelvy.model.service.imp.SujetoServicioImpl;
import org.soderiakelvy.model.util.ConstantModel;

public class TestSucursalPack {
	//@BeforeClass

	
	@Test
	public void testSucursalPackCrud(){
		
		SucursalServicio ss = new SucursalServicioImp();
		SucursalPackVO spVO = new SucursalPackVO();
		
		ProductoServicio ps = new ProductoServicioImp();
		
		
		spVO.setCantidad(10);
		spVO.setPack(ps.getPackById(1));
		spVO.setSucursal(null);
		
		
		//----------- TEST  DE ALTA DE UN SUCURSAL Pack ------------------
		Assert.assertEquals(ConstantModel.SUCCESS,ss.insertSucursalPackVO(spVO));
		System.out.println("TEST ALTA OK");
		//-----------------------------------------------------------------------------
		
		//----------- TEST  DE UPDATE UN SUCURSAL Pack -----------------------------
		spVO.setCantidad(11);
		Assert.assertEquals(ConstantModel.SUCCESS,ss.updateSucursalPackVO(spVO));
		System.out.println("TEST UPDATE OK");
		//-----------------------------------------------------------------------------
		
		//----------- TEST  DE GETALL Pack ------------------------
				List<SucursalPackVO> sucursalPacks = ss.getSucursalesPacks();
				Assert.assertEquals(sucursalPacks.size(), 1);
				for(SucursalPackVO sp1 : sucursalPacks){
					System.out.println(sp1);
				}
				
				System.out.println("TEST GETALL OK");
		//-----------------------------------------------------------------------------
		
		//----------- TEST  DE ELIMINACION UN pack ------------------------
		Assert.assertEquals(ConstantModel.SUCCESS,ss.deleteSucursalPackVO(spVO));
		System.out.println("TEST ELIMINAR OK");
		//-----------------------------------------------------------------------------

		
	}

}
